CREATE TABLE Smart_predio
(
	sm_scpredio INTEGER NOT NULL AUTO_INCREMENT,
	sm_nmpredio VARCHAR(50) NOT NULL,
	sm_scclaseuso INTEGER NOT NULL,
	sm_scclasepredio INTEGER NOT NULL,
	sm_dsubicacion VARCHAR(250) NOT NULL,
	sm_dsdireccion VARCHAR(250) NOT NULL,
	sm_fhingreso DATE NOT NULL,
	sm_fhmodificacion DATE NOT NULL,
	sm_fhretiro DATE,
	sm_cousuario VARCHAR(150) NOT NULL,
	sm_scubicacion INTEGER NOT NULL,
	sm_scdireccion INTEGER NOT NULL,
	PRIMARY KEY (sm_scpredio),
	KEY (sm_scclasepredio),
	KEY (sm_scdireccion),
	KEY (sm_scclaseuso),
	KEY (sm_scubicacion)
) 
;


ALTER TABLE Smart_predio ADD CONSTRAINT FK_Smart_predio_Smart_datos_maestros 
	FOREIGN KEY (sm_scclasepredio) REFERENCES Smart_datos_maestros (sm_scdatmaestro)
;

ALTER TABLE Smart_predio ADD CONSTRAINT FK_Smart_predio_Smart_direccion 
	FOREIGN KEY (sm_scdireccion) REFERENCES Smart_direccion (sm_scdireccion)
;

ALTER TABLE Smart_predio ADD CONSTRAINT FK_Smart_predio_Smart_maestros 
	FOREIGN KEY (sm_scclaseuso) REFERENCES Smart_maestros (sm_scmaestro)
;

ALTER TABLE Smart_predio ADD CONSTRAINT FK_Smart_predio_Smart_ubicacion 
	FOREIGN KEY (sm_scubicacion) REFERENCES Smart_ubicacion (sm_scubicacion)
;

